package com.zll.dubbouser.service.impl;

import com.zll.dubboapi.exception.MyException;
import com.zll.dubboapi.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

/**
 * @Description:
 * @Author: zll
 * @Date: 2020/11/3 6:06
 */
@Slf4j
@Service
@DubboService(retries = 0/*,stub = "com.zll.dubboapi.service.impl.UserServiceStub"*/)
public class UserServiceImpl implements UserService {
    @Override
    public String getAddress(String userName) {
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            log.error(e.getMessage());
        }
        log.info("我进入用户服务啦。。。");
        if (userName.length() < 5) {
            throw new MyException("我是异常消息");
        }
        return "hi" + userName;

    }
}
